﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ABCLogistic_System_V2._0.DA;

namespace ABCLogistic_System_V2._0.GUI
{
    public partial class frmQTHT_Nguoidung : Form
    {
        // khai bao bien toan cuc
        ABCLogisticsEntities context = new ABCLogisticsEntities();
        NHANVIEN nhanvien = new NHANVIEN();
        TAIKHOAN taikhoan = new TAIKHOAN();
        string gioitinh;
        public frmQTHT_Nguoidung()
        {
            InitializeComponent();
        }

        private void frmQTHT_Nguoidung_Load(object sender, EventArgs e)
        {
            
        }

        /// <summary>
        /// xu ly cua cac button luu, chinh sua,them moi
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
       
        // xu ly button luu
        private void btnluu_Click(object sender, EventArgs e)
        {
            nhanvien.MANV = txtMaNV.Text;
            nhanvien.HOVATENLOT = txthovatendem.Text;
            nhanvien.TEN = txtten.Text;
            nhanvien.TENKHAC = txttenkhac.Text;
               // nhanvien.GIOITINH;
            nhanvien.DIACHI = txtdiachi.Text;
            nhanvien.NGAYSINH = dbngaysinh.Value;
            nhanvien.SODIENTHOAI = txtsodienthoai.Text;
            nhanvien.FAX= txtFax.Text;
            nhanvien.EMAIL=txtEmail.Text;
            nhanvien.NHOM=cbxnhom.Text;
            nhanvien.NGAYVAOCONGTY= dbngayvaocongty.Value;

            if(){

                // luu
                context.NHANVIENs.AddObject(nhanvien);
                int count = context.SaveChanges();
                if (count > 0)
                {
                    MessageBox.Show("Lưu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {

                }
            }
    }

        private void radnam_CheckedChanged(object sender, EventArgs e)
        {
            gioitinh="Nam";
        }

        private void radNu_CheckedChanged(object sender, EventArgs e)
        {
            gioitinh="Nữ";
        }
    }
}
